package graphix;

import java.util.Vector;

/**
 * @author duncan
 */
public class Layer
{
    //Declare a Vector to hold the Entities.
    private Vector entities = new Vector();
    
    /**
     * Layer constructor.
     */
    public Layer()
    {
	
    }

    /**
     * Adds a new Entity to the Layer, and returns it's index.
     *
     * @return The new index.
     */
    public int addEntity(Entity entity)
    {
	entities.addElement(entity);
	return (entities.size() - 1);
    }

    /**
     * Removes the Entity with the specified index.
     */
    public void removeEntity(int index)
    {
	if ((index < 0) || (index >= entities.size()))
	    return;
	entities.removeElementAt(index);
    }

    /**
     * returns an array containing all the Entities on the Layer.
     *
     * @return
     */
    public Entity[] getEntities()
    {
	return (Entity[]) entities.toArray();
    }

    
}
